home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / network / ncsasock / s_file.h < prev    next >
Text File  |  1996-07-05  |  3KB  |  83 lines

  1. /*
  2.  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution is only permitted until one year after the first shipment
  6.  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
  7.  * binary forms are permitted provided that: (1) source distributions retain
  8.  * this entire copyright notice and comment, and (2) distributions including
  9.  * binaries display the following acknowledgement:  This product includes
  10.  * software developed by the University of California, Berkeley and its
  11.  * contributors'' in the documentation or other materials provided with the
  12.  * distribution and in all advertising materials mentioning features or use
  13.  * of this software.  Neither the name of the University nor the names of
  14.  * its contributors may be used to endorse or promote products derived from
  15.  * this software without specific prior written permission.
  16.  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  17.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  18.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19.  *
  20.  *    @(#)file.h    7.6 (Berkeley) 6/28/90
  21.  */
  22.  
  23. #ifdef KERNEL
  24. #include "fcntl.h"
  25. #include "unistd.h"
  26.  
  27. /*
  28.  * Descriptor table entry.
  29.  * One for each kernel object.
  30.  */
  31. struct file {
  32.     int    f_flag;        /* see below */
  33. #define    DTYPE_VNODE    1    /* file */
  34. #define    DTYPE_SOCKET    2    /* communications endpoint */
  35.     short    f_type;        /* descriptor type */
  36.     short    f_count;    /* reference count */
  37.     short    f_msgcount;    /* references from message queue */
  38.     struct    ucred *f_cred;    /* credentials associated with descriptor */
  39.     struct    fileops {
  40.         int    (*fo_read)();
  41.         int    (*fo_write)();
  42.         int    (*fo_ioctl)();
  43.         int    (*fo_select)();
  44.         int    (*fo_close)();
  45.     } *f_ops;
  46.     caddr_t    f_data;        /* inode */
  47.     off_t    f_offset;
  48. };
  49.  
  50. struct file *file, *fileNFILE;
  51. int nfile;
  52.  
  53. /* convert O_RDONLY/O_WRONLY/O_RDWR to FREAD/FWRITE */
  54. #define    FOPEN        (-1)
  55. #define    FREAD        1
  56. #define    FWRITE        2
  57.  
  58. /* kernel only versions -- deprecated, should be removed */
  59. #define    FCREAT        O_CREAT
  60. #define    FDEFER        O_DEFER
  61. #define    FEXCL        O_EXCL
  62. #define    FEXLOCK        O_EXLOCK
  63. #define    FMARK        O_MARK
  64. #define    FSHLOCK        O_SHLOCK
  65. #define    FTRUNC        O_TRUNC
  66.  
  67. /* bits to save after open */
  68. #define    FMASK        (FREAD|FWRITE|O_APPEND|O_ASYNC|O_NONBLOCK)
  69. /* bits not settable by fcntl(F_SETFL, ...) */
  70. #define    FCNTLCANT    (FREAD|FWRITE|O_DEFER|O_EXLOCK|O_MARK|O_SHLOCK)
  71.  
  72. #else
  73.  
  74. #include <s_fcntl.h>
  75. #include <s_unistd.h>
  76.  
  77. #endif
  78.  
  79. /* operation for lseek(2); renamed by POSIX 1003.1 to unistd.h */
  80. #define    L_SET        0    /* set file offset to offset */
  81. #define    L_INCR        1    /* set file offset to current plus offset */
  82. #define    L_XTND        2    /* set file offset to EOF plus offset */
  83.